
\chapter{Numbers}


{\it Numbers\/}\index{numbers} in {\bf T} are objects which represent real numbers.
Numbers come in three varieties: integers, ratios, and floating point
numbers.  Integers and ratios are exact models of the corresponding
mathematical objects.  Floating point numbers give discrete approximations
to real numbers within a certain implementation-dependent range.


As expressions, numbers are self-evaluating literals (see section
\ref{EQ?}).
\begin{codexenv}
    \begin{tabular}{lll}
-377            &$\Longrightarrow$\ &  -377 \\
72723460248141  &$\Longrightarrow$\ &  72723460248141 \\
13/5            &$\Longrightarrow$\ &  13/5 \\
34.55           &$\Longrightarrow$\ &  34.55
\end{tabular}
    \end{codexenv}

There may be many different objects which all represent the same number.
The effect of this is that {\tt EQ?} may behave in nonintuitive ways when
applied to numbers.  It is guaranteed that if two numbers have different
types or different numerical values, then they are {\it not\/}
{\tt EQ?}, but two numbers that appear to be the same may or may not be
{\tt EQ?}, even though there is no other way to distinguish them.  Use
{\tt EQUAL?} or {\tt =} (page \pageref{EQUAL?})  for comparing numbers.

\section{Predicates}


\index{NUMBER?@{\tt NUMBER?}}
{\mbox {\tt (NUMBER? {\it object\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill Type predicate

\begin{inset}{}
Returns true if {\it object\/} is a number.
\end{inset}

\index{INTEGER?@{\tt INTEGER?}}
{\mbox {\tt (INTEGER? {\it object\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill Type predicate

\begin{inset}{}
Returns true if {\it object\/} is an integer.
\end{inset}

\index{FLOAT?@{\tt FLOAT?}}
{\mbox {\tt (FLOAT? {\it object\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill Type predicate

\begin{inset}{}
Returns true if {\it object\/} is a floating point number.
\end{inset}

\index{RATIONAL?@{\tt RATIONAL?}}
{\mbox {\tt (RATIONAL? obj) $\longrightarrow$\  {\it boolean}}}
\hfill  

\begin{inset}{}
{\mbox {\tt RATIONAL?}} returns true if {\it obj} is an integer or
ratio; otherwise, it returns false.
\end{inset}

\index{RATIO?@{\tt RATIO?}}
{\mbox {\tt (RATIO? {\it object\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill Type predicate

\begin{inset}{}
Returns true if {\it object\/} is a ratio.
\end{inset} 

\index{ODD?@{\tt ODD?}}
{\mbox {\tt (ODD? {\it integer\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it integer\/} is odd.
\end{inset} 

\index{EVEN?@{\tt EVEN?}}
{\mbox {\tt (EVEN? {\it integer\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it integer\/} is even.
\end{inset} 

\section{Arithmetic}


\index{+@{\tt +}}
{\mbox {\tt (+ . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{ADD@{\tt ADD}}
{\mbox {\tt (ADD . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the sum of the {\it numbers\/}.
\begin{codexenv}
    \begin{tabular}{lll}
(+ 10 27)    &$\Longrightarrow$\ &  37 \\
(+ 10 27.8)  &$\Longrightarrow$\ &  37.8 \\
(+)          &$\Longrightarrow$\ &  0 \\
(+ -35)      &$\Longrightarrow$\ &  -35 \\
(+ 1 2 3)    &$\Longrightarrow$\ &  6
\end{tabular}
    \end{codexenv}
\end{inset}

\index{{\tt -}@{\tt {\tt -}}}
{\mbox {\tt ({\tt -} {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{SUBTRACT@{\tt SUBTRACT}}
{\mbox {\tt (SUBTRACT {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the difference of {\it n1\/} and {\it n2\/}.
\end{inset}

\index{{\tt -}@{\tt {\tt -}}}
{\mbox {\tt ({\tt -} {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{NEGATE@{\tt NEGATE}}
{\mbox {\tt (NEGATE {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the additive inverse of {\it n\/}.
\end{inset}

\index{*@{\tt *}}
{\mbox {\tt (* . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{MULTIPLY@{\tt MULTIPLY}}
{\mbox {\tt (MULTIPLY . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the product of the {\it numbers\/}.
\end{inset}

\index{/@{\tt /}}
{\mbox {\tt (/ {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{DIVIDE@{\tt DIVIDE}}
{\mbox {\tt (DIVIDE {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the quotient of {\it n1\/} and {\it n2\/}.
\begin{codexenv}
    \begin{tabular}{lll}
(/ 20 5)    &$\Longrightarrow$\ &  4 \\
(/ 5 20)    &$\Longrightarrow$\ &  1/4 \\
(/ 5.0 20)  &$\Longrightarrow$\ &  0.25
\end{tabular}
    \end{codexenv}
\end{inset}

\index{QUOTIENT@{\tt QUOTIENT}}
{\mbox {\tt (QUOTIENT {\it n1 n2\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Integer division; truncates the quotient of {\it n1\/} and {\it n2\/}
towards zero.
\end{inset}

\index{REMAINDER@{\tt REMAINDER}}
{\mbox {\tt (REMAINDER {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the remainder of the division of {\it n1\/} by {\it n2\/}, with
the sign of {\it n1\/}.
\end{inset} 

\index{QUOTIENT\&REMAINDER@{\tt QUOTIENT\&REMAINDER}}
{\mbox {\tt (QUOTIENT\&REMAINDER {\it n1 n2\/}) $\longrightarrow$\  {\it integer1 integer2\/}}}
\hfill  

\begin{inset}{}
Returns the quotient and remainder (respectively) as muiltiple
values of dividing {\it n1\/} by {\it n2\/}.
\end{inset}

\index{FLOOR@{\tt FLOOR}}
{\mbox {\tt (FLOOR {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the greatest multiple of {\it n2\/} which is less than or equal to {\it n1\/};
``round down''.
A particularly useful case is where {\it n2\/} is 1, in which case
{\tt FLOOR} returns {\it n1\/}'s integer part.
\begin{codexenv}
    \begin{tabular}{lll}
(FLOOR 21 8)    &$\Longrightarrow$\ &  16 \\
(FLOOR -21 8)   &$\Longrightarrow$\ &  -24 \\
(FLOOR 2.67 1)  &$\Longrightarrow$\ &  2
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{CEILING@{\tt CEILING}}
{\mbox {\tt (CEILING {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the least multiple of {\it n2\/} which is greater than or equal to {\it n1\/};
``round up''.
\begin{codexenv}
    \begin{tabular}{lll}
(CEILING 21 8)    &$\Longrightarrow$\ &  24 \\
(CEILING -21 8)   &$\Longrightarrow$\ &  16 \\
(CEILING 2.67 1)  &$\Longrightarrow$\ &  3
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{TRUNCATE@{\tt TRUNCATE}}
{\mbox {\tt (TRUNCATE {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the greatest multiple of {\it n2\/} which is less than or equal to the
absolute value of {\it n1\/}, with {\it n1\/}'s sign;
``round towards zero''.
\begin{codexenv}
    \begin{tabular}{lll}
(TRUNCATE 21 8)    &$\Longrightarrow$\ &  16 \\
(TRUNCATE -21 8)   &$\Longrightarrow$\ &  -24 \\
(TRUNCATE 2.67 1)  &$\Longrightarrow$\ &  1
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{ROUND@{\tt ROUND}}
{\mbox {\tt (ROUND {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Rounds {\it n1\/} toward the nearest multiple of {\it n2\/}.
\end{inset} 

\index{MOD@{\tt MOD}}
{\mbox {\tt (MOD {\it n1 n2\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns a number {\it k\/} in the range from zero, inclusive, to {\it n2\/},
exclusive, such that {\it k\/} differs from {\it n1\/} by an integral
multiple of {\it n2\/}.  If {\it n1\/} is positive, this behaves like
{\tt REMAINDER}.
\end{inset} 

\index{EXPT@{\tt EXPT}}
{\mbox {\tt (EXPT {\it base exponent\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns {\it base\/} raised to the {\it exponent\/} power.
{\it Base\/} and {\it exponent\/} may be any numbers.
\begin{inset}{Bug:}
In {\bf T} 3.1, {\it exponent\/} must be a finxnum.
\end{inset}
\end{inset} 

\index{ABS@{\tt ABS}}
{\mbox {\tt (ABS {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the absolute value of {\it n\/}.
\end{inset} 

\index{GCD@{\tt GCD}}
{\mbox {\tt (GCD {\it integer1 integer2\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Returns the greatest common divisor of {\it integer1\/} and {\it integer2\/}.
\begin{codexenv}
(GCD 36 60)  $\Longrightarrow$\   12
\end{codexenv}
\end{inset} 

\index{truncate@{\tt truncate}}
{\mbox {\tt (truncate {\it number}) $\longrightarrow$\  {\it integer}}}
\hfill  

\begin{inset}{}
{\mbox {\tt truncate}} returns the integer of maximal absolute
value not larger than the absolute value of {\it number} with
the same sign as {\it number}.  {\mbox {\tt truncate}} truncates
its argument toward zero.
\end{inset}

\index{ADD1@{\tt ADD1}}
{\mbox {\tt (ADD1 {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\index{1+@{\tt 1+}}
{\mbox {\tt (1+ {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns {\it n\/} + 1.
(See also {\tt INCREMENT}, page \pageref{INCREMENT}.)
\end{inset}

\index{-1+@{\tt -1+}}
{\mbox {\tt (SUBTRACT1 {\it n\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns {\it n\/} - 1.
(See also {\tt DECREMENT}, page \pageref{DECREMENT}.)
\end{inset}

\index{MIN@{\tt MIN}}
{\mbox {\tt (MIN . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the {\it number\/} with the least numerical magnitude.
(There must be at least one {\it number\/}.)
\end{inset} 

\index{MAX@{\tt MAX}}
{\mbox {\tt (MAX . {\it numbers\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\begin{inset}{}
Returns the {\it number\/} with the greatest numerical magnitude.
(There must be at least one {\it number\/}.)
\end{inset} 

\section{Comparison}


\index{=@{\tt =}}
{\mbox {\tt (= {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{EQUAL?@{\tt EQUAL?}}
{\mbox {\tt (EQUAL? {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\label{EQUAL?}
\begin{inset}{}
Returns true if {\it n1\/} is numerically equal to {\it n2\/}.
\end{inset}

\index{$<$@{\tt $<$}}
{\mbox {\tt ($<$ {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{LESS?@{\tt LESS?}}
{\mbox {\tt (LESS? {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n1\/} is numerically less than {\it n2\/}.
\end{inset}

\index{$>$@{\tt $>$}}
{\mbox {\tt ($>$ {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{GREATER?@{\tt GREATER?}}
{\mbox {\tt (GREATER? {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n1\/} is numerically greater than {\it n2\/}.
\end{inset}

\index{N=@{\tt N=}}
{\mbox {\tt (N= {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NOT-EQUAL?@{\tt NOT-EQUAL?}}
{\mbox {\tt (NOT-EQUAL? {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n1\/} is not numerically equal to {\it n2\/}.
\end{inset}

\index{$>$=@{\tt $>$=}}
{\mbox {\tt ($>$= {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NOT-LESS?@{\tt NOT-LESS?}}
{\mbox {\tt (NOT-LESS? {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n1\/} is not numerically less than {\it n2\/}.
\end{inset}

\index{$<$=@{\tt $<$=}}
{\mbox {\tt ($<$= {\it n1 n2\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n1\/} is not numerically greater than {\it n2\/}.
\end{inset}

\section{Sign predicates}


\index{=0?@{\tt =0?}}
{\mbox {\tt (=0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{ZERO?@{\tt ZERO?}}
{\mbox {\tt (ZERO? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n\/} is numerically equal to zero.
\end{inset}

\index{$<$0?@{\tt $<$0?}}
{\mbox {\tt ($<$0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NEGATIVE?@{\tt NEGATIVE?}}
{\mbox {\tt (NEGATIVE? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n\/} is negative.
\end{inset}

\index{$>$0?@{\tt $>$0?}}
{\mbox {\tt ($>$0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{POSITIVE?@{\tt POSITIVE?}}
{\mbox {\tt (POSITIVE? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{} 
Returns true if {\it n\/} is positive.
\end{inset}

\index{N=0?@{\tt N=0?}}
{\mbox {\tt (N=0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NOT-ZERO?@{\tt NOT-ZERO?}}
{\mbox {\tt (NOT-ZERO? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n\/} is not numerically equal to zero.
\end{inset}

\index{$>$=0?@{\tt $>$=0?}}
{\mbox {\tt ($>$=0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NOT-NEGATIVE?@{\tt NOT-NEGATIVE?}}
{\mbox {\tt (NOT-NEGATIVE? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n\/} is non-negative.
\end{inset}

\index{$<$=0?@{\tt $<$=0?}}
{\mbox {\tt ($<$=0? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\index{NOT-POSITIVE?@{\tt NOT-POSITIVE?}}
{\mbox {\tt (NOT-POSITIVE? {\it n\/}) $\longrightarrow$\  {\it boolean\/}}}
\hfill  

\begin{inset}{}
Returns true if {\it n\/} is non-positive.
\end{inset}

\section{Transcendental functions}


\index{EXP@{\tt EXP}}
{\mbox {\tt (EXP {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Exponential function (e$^{\hbox{{\it x\/}}}$).
\end{inset} 

\index{LOG@{\tt LOG}}
{\mbox {\tt (LOG {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Natural logarithm (log$_{\hbox{e}}${\it x\/}).
\end{inset} 

\index{SQRT@{\tt SQRT}}
{\mbox {\tt (SQRT {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Returns the square root of its argument.
\end{inset} 

\index{COS@{\tt COS}}
{\mbox {\tt (COS {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Returns the cosine of its argument.
\end{inset} 

\index{SIN@{\tt SIN}}
{\mbox {\tt (SIN {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Returns the sine of its argument.
\end{inset} 

\index{TAN@{\tt TAN}}
{\mbox {\tt (TAN {\it float\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Returns the tangent of its argument.
\end{inset} 

\index{ACOS@{\tt ACOS}}
{\mbox {\tt (ACOS {\it float1\/}) $\longrightarrow$\  {\it float2\/}}}
\hfill  

\begin{inset}{}
Arccosine.  Returns a number whose cosine is {\it float1\/}.
\end{inset} 

\index{ASIN@{\tt ASIN}}
{\mbox {\tt (ASIN {\it float1\/}) $\longrightarrow$\  {\it float2\/}}}
\hfill  

\begin{inset}{}
Arcsine.  Returns a number whose sine is {\it float1\/}.
\end{inset} 

\index{ATAN2@{\tt ATAN2}}
{\mbox {\tt (ATAN2 {\it x y\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Two-argument arctangent.  This computes the
angle between the positive x-axis and the point
({\it x\/}, {\it y\/}).  For example, if ({\it x\/}, {\it y\/}) is in the first or third
quadrant, {\tt (ATAN2 {\it x y\/})} returns the arctangent of {\it y\/}/{\it x\/}.

\begin{inset}{Bug:}
{\tt ATAN2} isn't implemented in {\bf T} 3.1.  {\bf T} 3.1 does
implement {\tt ATAN} (arctangent), however.
\end{inset}

\end{inset} 

\section{Bitwise logical operators}


\begin{inset}{Bug:}
In {\bf T} 3.1, the routines in this section are restricted to take
fixnums (see page \pageref{FIXNUM?}), not arbitrary integers.
\end{inset}

\index{LOGAND@{\tt LOGAND}}
{\mbox {\tt (LOGAND {\it integer1 integer2\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Returns the bitwise logical {\it and\/} of its arguments.
\begin{codexenv}
(LOGAND 10 12)  $\Longrightarrow$\   8
\end{codexenv}
\end{inset} 

\index{LOGIOR@{\tt LOGIOR}}
{\mbox {\tt (LOGIOR {\it integer1 integer2\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Returns the bitwise logical inclusive {\it or\/} of its arguments.
\end{inset} 

\index{LOGXOR@{\tt LOGXOR}}
{\mbox {\tt (LOGXOR {\it integer1 integer2\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Returns the bitwise logical exclusive {\it or\/} of its arguments.
\end{inset} 

\index{LOGNOT@{\tt LOGNOT}}
{\mbox {\tt (LOGNOT {\it integer\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Returns the bitwise logical {\it not\/} of its argument.
\end{inset} 

\index{ASH@{\tt ASH}}
{\mbox {\tt (ASH {\it integer amount\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Shifts {\it integer\/} to the left {\it amount\/} bit positions.
If {\it amount\/} is negative, shifts {\it integer\/} right by the absolute
value of {\it amount\/} bit positions.
\end{inset} 

\index{BIT-FIELD@{\tt BIT-FIELD}}
{\mbox {\tt (BIT-FIELD {\it integer position size\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Extracts a bit field out of {\it integer\/}.  The field extracted begins
at bit position {\it position\/} from the low-order bit of the integer
and consists of {\it size\/} bits.  The extracted field is returned
as a positive integer.
\begin{codexenv}
    \begin{tabular}{lll}
(BIT-FIELD 27 1 3)  &$\Longrightarrow$\ &  5 \\
(BIT-FIELD -1 4 5)  &$\Longrightarrow$\ &  31
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{SET-BIT-FIELD@{\tt SET-BIT-FIELD}}
{\mbox {\tt (SET-BIT-FIELD {\it integer position size value\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Inserts a value into a bit field of {\it integer\/}.  The field begins
at bit position {\it position\/} from the low-order bit of the integer
and consists of {\it size\/} bits.  A new integer is returned which is
the same as the argument {\it integer\/} except that this field has been
altered to be {\it value\/}.
\begin{codexenv}
(SET-BIT-FIELD 32 1 3 5)  $\Longrightarrow$\   42
\end{codexenv}
\end{inset} 

\section{Coercion}


\index{-$>$INTEGER@{\tt -$>$INTEGER}}
{\mbox {\tt (-$>$INTEGER {\it number\/}) $\longrightarrow$\  {\it integer\/}}}
\hfill  

\begin{inset}{}
Coerces {\it number\/} to an integer, truncating towards zero if necessary.
\begin{codexenv}
    \begin{tabular}{lll}
(-$>$INTEGER 17)     &$\Longrightarrow$\ &  17 \\
(-$>$INTEGER 7/4)    &$\Longrightarrow$\ &  1 \\
(-$>$INTEGER 17.6)   &$\Longrightarrow$\ &  17 \\
(-$>$INTEGER -17.6)  &$\Longrightarrow$\ &  -17
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{-$>$FLOAT@{\tt -$>$FLOAT}}
{\mbox {\tt (-$>$FLOAT {\it number\/}) $\longrightarrow$\  {\it float\/}}}
\hfill  

\begin{inset}{}
Coerces {\it number\/} to a floating point number.
\begin{codexenv}
    \begin{tabular}{lll}
(-$>$FLOAT 17)    &$\Longrightarrow$\ &  17.0 \\
(-$>$FLOAT 7/4)   &$\Longrightarrow$\ &  1.75 \\
(-$>$FLOAT 17.6)  &$\Longrightarrow$\ &  17.6
\end{tabular}
    \end{codexenv}
\end{inset} 

\section{Assignment}


{\tt INCREMENT} and {\tt DECREMENT} are assignment forms, like {\tt SET}
and {\tt PUSH}.  See section \ref{section:assignment} for a general
discussion.

\index{INCREMENT@{\tt INCREMENT}}
{\mbox {\tt (INCREMENT {\it location\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\label{INCREMENT}
\begin{inset}{}
Adds one to the value in {\it location\/}, stores the sum back
into {\it location\/}, and yields the sum.
\begin{codexenv}
    \begin{tabular}{lll}
(LSET L 6) \\
(INCREMENT L)             &$\Longrightarrow$\ &  7 \\
L                         &$\Longrightarrow$\ &  7 \\
(LSET M (LIST 10 20 30))  &$\Longrightarrow$\ &  (10 20 30) \\
(INCREMENT (CAR M))       &$\Longrightarrow$\ &  11 \\
M                         &$\Longrightarrow$\ &  (11 20 30) \\

(INCREMENT {\it location\/})  &$\equiv$&  (MODIFY {\it location\/} ADD1)
\end{tabular}
    \end{codexenv}
\end{inset} 

\index{DECREMENT@{\tt DECREMENT}}
{\mbox {\tt (DECREMENT {\it location\/}) $\longrightarrow$\  {\it number\/}}}
\hfill  

\label{DECREMENT}
\begin{inset}{}
Subtracts one from the value in {\it location\/}, stores the
difference back into {\it location\/}, and yields the difference.
\begin{codexenv}
(DECREMENT {\it location\/})  $\equiv$  (MODIFY {\it location\/} SUBTRACT1)
\end{codexenv}
\end{inset} 
